In [35]:
str_list = ["a", "b", "c", "d", "e"]
str_list.index("c")
str_list[1:3]
range(1, 3)


Out[35]:
[1, 2]

In [ ]:
def reverse(text):
    string = ""
    for i in range(1, len(text)+1):
        string += text[-i]
    return string
    
reverse('abcde')

In [102]:
def reverse(text):
    str_bag = ""
    for x in range(1, len(text)+1):
        idx = -x
        str_bag += text[idx]
    print str_bag
    
reverse("abcdea641461q3w51wqre5d")


d5erqw15w3q164146aedcba

In [11]:
import requests
from bs4 import BeautifulSoup

url = "http://www.inven.co.kr/board/powerbbs.php?come_idx=3370"
res = requests.get(url)
soup = BeautifulSoup(res.content)

for x in soup.find_all('td', attrs = {'class' : 'bbsSubject'}):
    print x.a['href']


http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=276754
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=276998
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359506
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359504
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359503
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359502
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359501
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359500
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359499
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359498
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359497
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359496
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359495
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359494
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359493
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359492
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359490
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359489
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359488
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359487
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359486
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359485
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359484
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359483
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359482
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359481
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359480
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359479
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359478
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359477
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359474
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359473
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359472
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359471
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359470
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359469
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359468
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359467
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359466
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359465
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359464
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359463
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359462
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359461
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359460
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359459
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359458
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359457
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359456
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359455
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359454
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359453
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359452
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359451
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359450
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359449
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359448
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359447
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359446
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359445
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359444
http://www.inven.co.kr/board/powerbbs.php?come_idx=3370&l=359443

In [34]:
class person(object):
    def __init__(self):
        self.life = 100
    
    def damaged(self):
        self.life -= 10
        print 'Damaged! -10 HP, Life remains', self.life

a1 = person()

# super: parent 클래스의 객체반환
class my(person):
    def __init__(self):
        super(my, self).__init__()
        self.str = 20
        self.int = 10
    # overriding
    def attack(self):
        print 'Attack!'
        
class dy(person):
    def __init__(self):
        super(dy, self).__init__()
        self.str = 10
        self.int = 20
    # overriding
    def attack(self):
        print 'Magic Attack!'        

a2 = my()
a3 = dy()
a3.attack()


Magic Attack!

In [59]:
class person(object):
    def __init__(self):
        self.life = 100
    
    def damaged(self):
        self.life -= 10
        print 'Damaged! HP -10, Life remains', self.life

class wizard(person):
    def __init__(self):
        super(wizard, self).__init__()
        self.str = 10
        self.int = 200
    def attack(self):
        print 'Fireball! {} Damage!'.format(self.int)

class warrior(person):
    def __init__(self):
        super(warrior, self).__init__()
        self.str = 200
        self.int = 10
    def attack(self):
        print 'Bash! {} Damage!'.format(self.str)
        
my = wizard()
dy = warrior()
print dy.str, dy.int, dy.life
dy.attack()
dy.damaged()


200 10 100
Bash! 200 Damage!
Damaged! HP -10, Life remains 90

In [69]:
class cal(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y
        
    def add(self):
        return self.x + self.y
    
    def sub(self):
        return self.x - self.y
    
a = cal(10, 10)

def add(x, y):
    return x+y
def sub(x, y):
    return x-y

n1 = 10
n2 = 20
n3 = 30
n4 = 40

print add(n1, n2)
print add(n2, n3)
print add(n3, n4)
print sub(n4, n1)


20
0

In [14]:
import requests
from bs4 import BeautifulSoup

url = "http://blog.naver.com/PostView.nhn?blogId=kissangel007&logNo=220917733538&redirect=Dlog&widgetTypeCall=true&topReferer=https%3A%2F%2Fsearch.naver.com%2Fsearch.naver%3Fwhere%3Dnexearch%26query%3D%25EC%259E%25A5%25EC%259A%25A9%25EC%25A4%2580%26sm%3Dtop_lve%26ie%3Dutf8"
res = requests.get(url)
soup = BeautifulSoup(res.content)

for x in soup.find_all('div', attrs = {'id' : 'postViewArea'}):
    print x.get_text()



리더스 인솔루션 스페셜 패키지
주름개선 / 동안피부 / 캐비어 화장품 /LED



 


나나.. 이뻐??? 
훔 .. 예쁘단 소리는 나이가 들어도 참... 기분 좋죠?
누구나 여자라면 예뻐요 어려보여요 요런 이야기 들음 므흣므흣 ~

하지만!! 나이가들다보면 
눈가에도 .. 입가에도 자글자글 .. 흑 ~
주름 고민 ..... ㅠㅜ;; 

저 역시 이젠 앞자리가 바뀌면서 ... 고민 고민 주름고민
동안피부로 다시 태어나고싶다요!!!!!!!



그럼 무슨 마법의 물약 같은거라도 없나??
세월을 되돌릴 수 있는 그런? ㅋ ~

뭐 .. 세월을 되돌리는건 불가능하지만
주름개선 동안피부는 ~ 얼마든지 만들 수 있지요 
매일 ~ 에스테틱 가서 관리 받는거 말고요 (주부가 뭔? ㅋ)
집에서도 내 힘으로 ~ 아니아니 요요 리더스의 힘으로 말이예요 ^^


리더스 인솔루션 스페셜 패키지 
 
 

▼▽▼▽▼▽▼
 

 

 
 


400억 돌파!!!! 백화점 브랜드 리더스
 
서울대 출신의 전문가가 모여서 10여년의 연구 끝에 개발한 ~ 피부 주름 개선에 좋은 ~ 화장품
그래서 에스테틱 안가고 집에서도 내가내가 셀프로 매일매일 관리 할 수 있는 ~ 딱 맘에드는 ㅎㅎ

이번에 더더 특별하게 ~~ 리더스 인솔루션 스패셜 패키지로 만났답니다요 
 


 

 
 
리더스 인솔루션 블랙캐비어 기초 신상 3종세트  
리더스 블랙캐비어 플루이드 145ml리더스 블랙캐비어 세럼 90ml리더스 블랙캐비어 크림 65g
리더스 프리미엄 플라센텔라 크림
리더스 인솔루션 에스테틱 케어 V2
리더스 인솔루션 링클 오프 더블 이엑스
 
 

 



리더스 인솔루션 블랙캐비어 기초 신상 3종세트  
 
미백개선 / 주름개선 / 영양공급 /탄력개선 

비타민 &단백질 ... 영양성분이 듬뿍~ 담긴 캐비어가 화장품 속에 쏘옥 ~
나나나.. 내 피부에 딱 필요한 ~ 미백, 주름, 탄력 개선해주는 기초 3종세트네요 




 
  

 

리더스 블랙캐비어 플루이드 
 
수분을 공급해주고 피부결도 정돈해주는 ~
특히 물처럼 흐르는 타입이 아닌 에센스 타입의 토너 

세안 후 남아있는 수분까지 꽉 잡아주고 내 피부를 더더 촉촉하게 ~해주능요 


 

 
  


리더스 블랙캐비어 세럼 
영양 공급은 물론 유수분 밸런스를 유지시켜주는 안티에이징 세럼
영양과 수분을 동시에 잡아주지요 

마치 젤리처럼 보드랍고 말랑한 타입이라 피부에 닿는 느낌까지도 기분 좋답니다요 ^^




  
  



 리더스 블랙캐비어 크림

피부 탄력을 증진시켜주는 안티에이징 크림 
고농축의 쫀쫀하고~ 촉촉한 ~ 그래서 바르자마자 피부를 보호해주는 느낌 ~ 




 

 

리더스 인솔루션 에스테틱 케어 V2
 
진동 / LED / 미세전류 

집에서도 셀프로 오키오키 ~
 전문 에스테틱 수준의 홈케어도 가능하다니 ~GOOD!!
 

 
 
 
 
​
이렇게 BLUE& RED 2단계 기능으로 단계별로 피부 케어가 가능하답니다요 
 
BLUE 1단계 : (버튼 한번 꾸욱~) 램프가 푸른빛으로 ~
스킨케어 흡수를 높여주고 촉촉 ~ 피부를 유지하게 도와준답니다 
 
RED 2단계 : (버튼 두번 꾸욱~) 램프가 붉은 빛으로 ~
​스킨케어의 흡수를 높여주는건 기본 마사지 효과로 피부 관리를 도와준답니다
​
 
 

 
 
​
이렇게 ~~ 기초 & 케어 화장품 사용 후 흡수를  높이기위해 ~ 사용해요 
*5분 후엔 자동으로 전원이 꺼진답니다 
 
 
 
 <리더스 인솔루션 에스테틱 케어 V2 사용 영상입니다요>
 
​ 
 

 



리더스 인솔루션 에스테틱 캐어 V2

간단하게 작동하고 건전지만 넣으면 휴대하기도 편하니까 ~~~
​요즘은 여행 갈 때에도 저의 필템!!!​
​
클러치 & 파우치 안에 쏘옥 ~ 담아가지고 잠자리에 들기전 지친 피부를 위해 ~ 윙윙=3=3 
 


 

 
 
리더스 인솔루션 링클 오프 더블 이엑스
 
주름 개선 기능성 화장품​

 
진심 나이가 들면 피부가 노화되니 점점점 ... 주름이..... 흑 ~
왜왜왜?? ... 자외선 때문에 프로비타민D3가 감소하기 때문이라네요 
 
그래서 ... 필요한 프로비타민D3를 ~~ 넣어주어야지요 
 
 


 
 
 
인솔루션 링클 오프 더블 이엑스​는 바로 요요 프로비타민D3 특허성분이 2배나 ~
그래서 자외선으로부터 피부를 보호해주고~ 주름개선을 해주는 ~
​
​
 



 
 
 
하루에 한눈금씩 ~(아침저녁으로 반눈금정도) 주름 고민인 곳에 ~ 바르고 흡수시켜주어요
저는 주로 눈가나 목주름 고민이 심해서 목부위에 듬뿍 ~발라준답니다요 ^^
 
 
 

 
 
 
눈가주름, 팔자주름, 이마주름, 보습  개선에도 도움을 주는 ~~​
전국 에스테틱에서도 사용하고있는 ~​
​
요요게 바로 400억 판매 신화의 베스트 아이템이지요 
 
 
 

 

 
 
 
리더스 프리미엄 플라센텔라 크림
 
​피부에 풍부한 영양분을 공급해주는 ~ 태반크림의 결정판!!
​
​지친 피부를 맑고 깨끗하게 ~ 주름 개선과 미백 효과를 동시에 ~주는 영양크림
끈적이 없이 촉촉한 ​타입으로 피부 흡수율도 아주 좋네요 ^^​
 
 




 
​
 
리더스 인솔루션 스페셜 패키지로 일주일정도 아침 저녁으로 꾸준히 관리해준 후의 변화!!
우오우오 ~~~ 무엇보다 피부의 잡티가 흐릿해진게 눈에 띄게 보이지요? 그리고 마치 살이 오른듯하게 팽팽해진 ~
​
역시 역시 .. 여자는 늘상 관리가 필요하다니까요 ㅎㅎ
그래서 오늘밤에도 저는 리더스와 함께한답니다요 ~~
​
맑고 깨끗한 ~ 주름 없는 내 피부를 위하여 ~~~~​
 
 


 
 

    4000억 돌파!!!  리더스 인솔루션 홈앤쇼핑에서 최다 구성 패키지로 만날 수 있답니다요

1월23일 07시30분 / 1월 27일 21시30분 방송예정!!   
​

우리 잇님들도 잊지마시고요  리더스의 특별한 구성 득템하세요 ^^
 
#미즈넷체험단 #리더스링클
 

 




In [40]:
import requests
from bs4 import BeautifulSoup

for p_num in range(1, 2):
    url = "http://program.tving.com/tvn/dokebi/4/Board/List?page={}".format(p_num)
    #print url
    res = requests.get(url)
    soup = BeautifulSoup(res.content)
    
    for x in soup.find_all('td', attrs = {'class' : 'title'}):
        urls = "http://program.tving.com/" + x.a['href']
        res2 = requests.get(urls)
        soup2 = BeautifulSoup(res2.content)
        
        if urls[-4:] == '2491' or urls[-4:] == '2300' or urls[-4:] == '2081':
            pass
        else:
            for contents in soup2.find_all('div', attrs = {'class' : 'ContentWrap'}):
                title = contents.p.get_text()
                content = contents.select('div.area_con')[0].get_text()
                date = contents.select('span.date')[0].get_text()[5:10]
                view contents.select('span.view')[0].get_text()


67
95
196
257
291
209
302
347
274
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-40-6f2ef9cbf67e> in <module>()
     10     for x in soup.find_all('td', attrs = {'class' : 'title'}):
     11         urls = "http://program.tving.com/" + x.a['href']
---> 12         res2 = requests.get(urls)
     13         soup2 = BeautifulSoup(res2.content)
     14 

D:\Anaconda2\lib\site-packages\requests\api.pyc in get(url, params, **kwargs)
     68 
     69     kwargs.setdefault('allow_redirects', True)
---> 70     return request('get', url, params=params, **kwargs)
     71 
     72 

D:\Anaconda2\lib\site-packages\requests\api.pyc in request(method, url, **kwargs)
     54     # cases, and look like a memory leak in others.
     55     with sessions.Session() as session:
---> 56         return session.request(method=method, url=url, **kwargs)
     57 
     58 

D:\Anaconda2\lib\site-packages\requests\sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    486         }
    487         send_kwargs.update(settings)
--> 488         resp = self.send(prep, **send_kwargs)
    489 
    490         return resp

D:\Anaconda2\lib\site-packages\requests\sessions.pyc in send(self, request, **kwargs)
    607 
    608         # Send the request
--> 609         r = adapter.send(request, **kwargs)
    610 
    611         # Total elapsed time of the request (approximately)

D:\Anaconda2\lib\site-packages\requests\adapters.pyc in send(self, request, stream, timeout, verify, cert, proxies)
    421                     decode_content=False,
    422                     retries=self.max_retries,
--> 423                     timeout=timeout
    424                 )
    425 

D:\Anaconda2\lib\site-packages\requests\packages\urllib3\connectionpool.pyc in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
    592                                                   timeout=timeout_obj,
    593                                                   body=body, headers=headers,
--> 594                                                   chunked=chunked)
    595 
    596             # If we're going to release the connection in ``finally:``, then

D:\Anaconda2\lib\site-packages\requests\packages\urllib3\connectionpool.pyc in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    382         try:
    383             try:  # Python 2.7, use buffering of HTTP responses
--> 384                 httplib_response = conn.getresponse(buffering=True)
    385             except TypeError:  # Python 2.6 and older, Python 3
    386                 try:

D:\Anaconda2\lib\httplib.pyc in getresponse(self, buffering)
   1119 
   1120         try:
-> 1121             response.begin()
   1122             assert response.will_close != _UNKNOWN
   1123             self.__state = _CS_IDLE

D:\Anaconda2\lib\httplib.pyc in begin(self)
    436         # read until we get a non-100 response
    437         while True:
--> 438             version, status, reason = self._read_status()
    439             if status != CONTINUE:
    440                 break

D:\Anaconda2\lib\httplib.pyc in _read_status(self)
    392     def _read_status(self):
    393         # Initialize with Simple-Response defaults
--> 394         line = self.fp.readline(_MAXLINE + 1)
    395         if len(line) > _MAXLINE:
    396             raise LineTooLong("header line")

D:\Anaconda2\lib\socket.pyc in readline(self, size)
    478             while True:
    479                 try:
--> 480                     data = self._sock.recv(self._rbufsize)
    481                 except error, e:
    482                     if e.args[0] == EINTR:

KeyboardInterrupt: